<%--
  @desc: 停车位查询
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 <meta name="format-detection" content="telephone=no">
 <meta name="apple-mobile-web-app-capable" content="yes">
 <meta name="apple-mobile-web-app-status-bar-style" content="black">
 <link rel="stylesheet" type="text/css" href="<c:url value='/resource/weixin/css/global.css'/>">
<script src="<c:url value='/resource/weixin/js/jquery-1.8.3.min.js'/>"></script>
<script src="<c:url value='/resource/weixin/js/main.js'/>"></script>
<title>停车位查询</title>
</head>

<body>
<ul class="tab_menu tab_menu_1 clearfix">
    <li><a href="<c:url value='/weixin/bmsrv/lkcx'/>">实时路况</a></li>
    <li><a href="<c:url value='/weixin/loadmap'/>?searchname=-1&searchid=-1&maplng=-1&maplat=-1">便民地图</a></li>
    <li class="menu_li_current"><a href="<c:url value='/weixin/bmsrv/park'/>">停车位查询</a></li>
</ul> 

<!--wrap-page-->
<div class="wrap-page" style="top:25px;">
  <!--链接网页-->
  <div class="row">
  	<div class="input_div">
		<input type="button" value="刷新获取最新停车位信息" class="submit_input"  onclick="javascript:refresh();" >
	</div>
  	<table width="100%" border="1" class="park_tab">
  <tr>
    <th>停车场</th>
    <th><div align="center">剩余停车位个数</div></th>
  </tr>
  
</table>

	

  </div>
  
</div>

</body>
<script type="text/javascript">
$(function () {  
    $.ajax({  
        url: "<c:url value='/weixin/query/bmsrv/parking'/>",  
        type: 'GET',  
        dataType: 'json',  
        timeout: 1000,  
        beforeSend: function () {
    		lockBg();
        },    
        success: function succFunction(resp) { 
			if(resp&&resp.succ){
				unlockBg();
				var jsons = JSON.parse(resp.data); 
				var json = jsons.result.parkList;
	            $.each(json, function (index, item) {  
	            var parkName = item.parkName;
	            var seatIdle = item.seatIdle;
	            $(".park_tab").append("<tr>"+
	        		            "<td>"+parkName+"</td>"+
	        		            "<td>"+
	        		               "<div align='center'>"+seatIdle+"</div>"+
	        		             "</td>"+
	        		         "</tr>");
	            });
	          
			}else{
				alert("error");
			}
        }
    }) ; 
    
   
  });
  
  function refresh(){
	  window.location.href="<c:url value='/weixin/bmsrv/park'/>";
  }

</script>

</html>
